package com.itheima.d6_object_stream;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

/*
  目标：掌握对象字节输出流的使用：序列化对象。
 */
public class Test1ObjectOutputStream {
    public static void main(String[] args) throws IOException {

        ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("test.txt"));
        //创建对象
        Student stu = new Student("小黑", 18);
        //将对象写入文件内
        oos.writeObject(stu);
        oos.close();
    }

}
